package tests;

import static org.junit.Assert.*;

import org.junit.Test;

import constants.Colors;
import constants.Difficulties;
import constants.Races;
import data.Player;
import data.Shopping;
import data.Store;

public class ShoppingTest {

	 @Test
	    public void testShopping() throws Exception{
	    	 //map.buildPlayer("1", Races.HUMAN, Colors.BLUE);
	    	 //Player player = map.getCurrentPlayer();
	    	 int[] resources = new int[3];
	    	 Player player = new Player("Brett", Races.HUMAN, Colors.BLUE, resources);
	    	 Store store = new Store(Difficulties.BEGINNER);
	    	
	    	 //Food - Player has 600 money; food cost 40
	    	 assertFalse(Shopping.playerBuysFood(player, store, 500));
	    	 assertTrue(Shopping.playerBuysFood(player, store, 1));
	    	 assertEquals(player.getMoney(), 560);
	    	 
	    	 assertEquals(store.getMoney(), 2040);
	    	 assertEquals(store.getFoodStock(), 49);
	    	 
	    	 //Energy - Player has 560 money; energy cost 70
	    	 assertFalse(Shopping.playerBuysEnergy(player, store, 500));
	    	 assertTrue(Shopping.playerBuysEnergy(player, store, 1));
	    	 assertEquals(player.getMoney(), 490);
	    	 
	    	 assertEquals(store.getMoney(), 2110);
	    	 assertEquals(store.getFoodStock(), 49);
	    	 
	    	 
	    	 //Ore - Player has 460 money; ore cost 100
	    	 assertFalse(Shopping.playerBuysOre(player, store, 500));
	    	 assertTrue(Shopping.playerBuysOre(player, store, 1));
	    	 assertEquals(player.getMoney(), 390);
	    	 
	    	 assertEquals(store.getMoney(), 2210);
	    	 assertEquals(store.getOreStock(), 19);
	    }

}
